<template>
	<view class="record">
		<template v-for="(item,index) in list">
			<view class="black_1">
				<view class="left">
					<image :src="item.shop.avatar" mode="" />
				</view>
				<view class="middle">
					<view class="label_1">
						<text class="text1">
							{{item.shop.name}}
						</text>
						<text class="text2">ZY数量：{{item.num}}</text>
					</view>

					<view class="label_2">开始时间:
						<uni-dateformat :date="item.add_time" format="MM-dd hh:mm:ss">
						</uni-dateformat>
					</view>
					<view class="label_2">结束时间:
						<uni-dateformat :date="item.end_time" format="MM-dd hh:mm:ss">
						</uni-dateformat>
					</view>
				</view>
				<view class="right">
					<view class="label_1" :class="getClass(item.green_num)">
						{{parseFloat(item.green_num) >0? '+'+item.green_num:item.green_num}}
						<view class="text1">
							绿色积分
						</view>
					</view>

				</view>
			</view>
		</template>
		<template v-if="list.length == 0">
			<view class="Tips">
				暂无数据
			</view>
		</template>

	</view>
</template>

<script>
	export default {

		data() {
			return {
				list: [{
					"id": 15135,
					"shop_id": 11,
					"num": 100,
					"green_num": "160.00",
					"add_time": "01-04 15:05",
					"end_time": "01-19 15:05",
					"shop": {
						"id": 11,
						"name": "质押15天",
						"avatar": "http://zy-trade.test/uploads/20240104/5a5dd05698d2dfd3c37fd21e35663b31.png"
					},
				}],
				page: 1,

			};
		},
		onLoad() {
			this.list.length = 0
			this.getList()
		},
		methods: {
			getClass(type) {
				type = parseFloat(type)
				if (type < 0) {
					return 'text3'
				} else {
					return 'text2'
				}
			},
			getStatusName(type) {

			},

			getReceive(id, type) {


			},
			getList() {
				var data = {
					account_type: 'jackpot',
					page: this.page
				}
				var that = this
				this.api.http.requests('pledgeshop/myOrder', {}, res => {
					if (res.data && res.data.length > 0) {
						that.list = that.list.concat(res.data)
					}
				}, "POST")
			}
		},
		onReachBottom() {
			this.page = this.page + 1
			this.getList()
		}
	}
</script>
<style>
	page {
		background-color: white;
	}
</style>
<style scoped lang="less">
	.black_1 {
		display: flex;
		justify-content: space-between;
		padding: 10px;
		align-items: center;
		background: #FFFFFF;
		border-radius: 14rpx;
		margin: 0px 0px 20px 0px;
		background-color: white;
		border-radius: 5px;
		border-bottom: 1rpx solid #DFDFDF;
		.left {
			width: 120rpx;
			height: 120rpx;

			image {
				width: 60px;
				height: 60px;
			}
		}

		.middle {
			margin-left: 10px;
			flex: 1;

			.label_1 {
				font-size: 35rpx;
				font-weight: bold;
				color: #1A1A1A;

				.text2 {
					margin-left: 10px;
					font-size: 28rpx;
					font-weight: 400;
					color: #000000;

				}

				.text3 {
					color: #FE903D;
				}
			}

			.label_2 {
				margin-top: 10px;
				font-size: 24rpx;
				font-weight: 400;
				color: #B7B7B7;
			}
		}

		.right {

			.label_1 {
				border-radius: 20px;
				padding: 5px 15px;
				color: #7D7D7D;

				.text1 {
					text-align: center;
					font-size: 10px;
					font-weight: 400;
					color: #000000;
				}
			}

			.text2 {
				width: 50px;
				text-align: center;
				// background-color: #FFBD4A;
				color: #FE903D;
			}

			.text3 {
				text-align: center;
				width: 50px;
				// background-color: #5878E8;
			}
		}


	}

	.Tips {
		text-align: center;
		margin-top: 100px;
		color: gray;
	}
</style>